<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        body{
            padding: 0;
            margin: 0;
        }
        #box{
            width: 50%;
            /*  */
            padding-top: 25%;
            padding-bottom: 25%;
            background-color: #111;
            color: #fff;
            position: relative;
            text-align: center;
            line-height: 0;
            transform: translate(50%, 25%);
        }
    </style>
</head>
<body>
    
    <div id="box">
        box123
    </div>
</body>
</html>